#ifndef CC_MALLOC_H
#define CC_MALLOC_H

/****	Public header file	*/
#include "./cc_type.h"

/****	define */

#define CFG_DYNAMIC_ALLOCATE	// 基于 BitMap 实现
#ifdef 	CFG_DYNAMIC_ALLOCATE	  

typedef struct CC_Block_Pool tBlkPool;

extern void BlkPool_ShowBMap(uint8_t* pStr,tBlkPool* pObj);
extern void BlkPool_Show(uint8_t* pStr,tBlkPool* pObj);
extern tBlkPool* BlkPool_Create(uint16_t BlockSz,uint16_t BlockNum);
extern uint8_t* BlkPool_DynAlloc(tBlkPool* pObj,uint16_t ByteNum);
extern int BlkPool_Release(tBlkPool* pObj,void* ptmp); // 返回释放的数据块数量

#endif

#define CFG_SYS_MALLOC
#ifdef CFG_SYS_MALLOC

#define CFG_MEM_BLOCK_SZ 16

extern void MemHeap_ShowUsed(void);
extern void MemHeap_ShowBiMap(void);
extern void MemHeap_Init(uint16_t BNum);// ByteNum ： heap 字节数量
extern void* MemHeap_Alloc(uint16_t ByteNum,uint16_t Line);
extern int MemHeap_Free(void* ptmp,uint16_t Line);

#define MALLOC(A) 	MemHeap_Alloc((A),__LINE__)
#define MFREE(A) 	MemHeap_Free((A),__LINE__)

#endif

// void* cc_malloc(unsigned long BufSize);
// int cc_free(void* Prr);


#endif

